FROM python:3.12-slim

RUN pip install --no-cache-dir pdm

WORKDIR /app

COPY pyproject.toml pdm.lock ./

RUN pdm sync

COPY . .

EXPOSE 8080

VOLUME /app/instance

CMD ["sh", "-c", "pdm run flask init-db && pdm run gunicorn -b 0.0.0.0:8080 app:app"]